<template>
  <section>
    <header class="header-area">
      <div class="main-header">
        <div class="container">
          <div class="row">
            <div class="col-lg-12" style="width: 100%;">
              <div
                class="main-header-item d-flex justify-content-between align-items-center"
              >
                <div class="main-header-menus  d-flex">
                  <div class="logo" style="height: 10px">
                    <a href="/"
                      ><img
                        style="height: 70px"
                        src="/assets/images/logo.png"
                        alt=""
                    /></a>
                  </div>

                  <div class="header-menu d-none d-lg-block">
                    <ul>
                      <li>
                        <a class="active" @click="$router.push('/')">首页</a>
                      </li>
                      <li>
                        <a href="#" @click="$router.push('search')"
                          >信息智能处理</a
                        >
                        <ul v-if="username" class="sub-menu">
                          <li>
                            <nuxt-link to="/search">信息处理</nuxt-link>
                          </li>
                        </ul>
                      </li>
                      <li>
                        <a href="#" @click="$router.push('single-service')"
                          >智能处理样理展示</a
                        >
                        <ul v-if="username" class="sub-menu">
                          <li>
                            <nuxt-link to="/single-service">样例展示</nuxt-link>
                          </li>
                        </ul>
                      </li>
                      <li>
                        <a href="#" @click="$router.push('authors')"
                          >经典作者介紹</a
                        >
                        <ul v-if="username" class="sub-menu">
                          <li><nuxt-link to="/authors">作者介绍</nuxt-link></li>
                          <li>
                            <nuxt-link to="/single-author">作者详情</nuxt-link>
                          </li>
                        </ul>
                      </li>
                      <li>
                        <a href="#" @click="$router.push('hist')"
                          >查看历史记录</a
                        >
                        <ul v-if="username" class="sub-menu">
                          <li><nuxt-link to="/hist">历史记录</nuxt-link></li>
                        </ul>
                      </li>
                      <li>
                        <a v-if="!username" @click="$router.push('login')"
                          >去登陆</a
                        >
                        <span v-else>{{ username }}</span>
                      </li>
                      <li>
                        <a v-if="username" @click="Esc()">退出</a>
                      </li>
                    </ul>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </header>
    <div class="news-area news-posts-area ">
      <div class="container">
        <div class="row justify-content-center">
          <div class="col-lg-4 col-md-6 col-sm-9">
            <div class="news-item mt-30">
              <div class="news-thumb">
                <img src="/assets/images/project-1.png" alt="news" />
              </div>
              <div class="news-content text-center">
                <nuxt-link to="/single-author">司马相如</nuxt-link>
                <div class="date">
                  <span
                    ><span>公元前179年</span
                    ><span class="pl-10 pr-10"> -</span> 公元前118年</span
                  >
                </div>
              </div>
            </div>
          </div>
          <div class="col-lg-4 col-md-6 col-sm-9">
            <div class="news-item mt-30">
              <div class="news-thumb">
                <img src="/assets/images/project-2.png" alt="news" />
              </div>
              <div class="news-content text-center">
                <nuxt-link to="/single-author">司马迁</nuxt-link>
                <div class="date">
                  <span
                    ><span>前145年或前135年</span
                    ><span class="pl-10 pr-10"> -</span> 不可考</span
                  >
                </div>
              </div>
            </div>
          </div>
          <div class="col-lg-4 col-md-6 col-sm-9">
            <div class="news-item mt-30">
              <div class="news-thumb">
                <img src="/assets/images/project-3.png" alt="news" />
              </div>
              <div class="news-content text-center">
                <nuxt-link to="/single-author">班固</nuxt-link>
                <div class="date">
                  <span
                    ><span>公元32年</span
                    ><span class="pl-10 pr-10"> -</span> 公元92年</span
                  >
                </div>
              </div>
            </div>
          </div>
          <div class="col-lg-4 col-md-6 col-sm-9">
            <div class="news-item mt-30">
              <div class="news-thumb">
                <img src="/assets/images/project-4.png" alt="news" />
              </div>
              <div class="news-content text-center">
                <nuxt-link to="/single-author">张衡</nuxt-link>
                <div class="date">
                  <span
                    ><span>公元78年</span
                    ><span class="pl-10 pr-10"> -</span> 公元139年</span
                  >
                </div>
              </div>
            </div>
          </div>
          <div class="col-lg-4 col-md-6 col-sm-9">
            <div class="news-item mt-30">
              <div class="news-thumb">
                <img src="/assets/images/project-5.png" alt="news" />
              </div>
              <div class="news-content text-center">
                <nuxt-link to="/single-author">苏轼</nuxt-link>
                <div class="date">
                  <span
                    ><span>1037年1月8日</span
                    ><span class="pl-10 pr-10"> -</span> 1101年8月24日</span
                  >
                </div>
              </div>
            </div>
          </div>
          <div class="col-lg-4 col-md-6 col-sm-9">
            <div class="news-item mt-30">
              <div class="news-thumb">
                <img src="/assets/images/project-6.png" alt="news" />
              </div>
              <div class="news-content text-center">
                <nuxt-link to="/single-author">左丘明</nuxt-link>
                <div class="date">
                  <span
                    ><span>生卒年</span
                    ><span class="pl-10 pr-10"> -</span> 不详</span
                  >
                </div>
              </div>
            </div>
          </div>
          <div class="col-lg-4 col-md-6 col-sm-9">
            <div class="news-item mt-30">
              <div class="news-thumb">
                <img src="/assets/images/project-7.png" alt="news" />
              </div>
              <div class="news-content text-center">
                <nuxt-link to="/single-author">贾谊</nuxt-link>
                <div class="date">
                  <span
                    ><span>公元前200年</span
                    ><span class="pl-10 pr-10"> -</span> 公元前168年</span
                  >
                </div>
              </div>
            </div>
          </div>
          <div class="col-lg-4 col-md-6 col-sm-9">
            <div class="news-item mt-30">
              <div class="news-thumb">
                <img src="/assets/images/project-8.png" alt="news" />
              </div>
              <div class="news-content text-center">
                <nuxt-link to="/single-author">扬雄</nuxt-link>
                <div class="date">
                  <span
                    ><span>前53年</span
                    ><span class="pl-10 pr-10"> -</span> 18年</span
                  >
                </div>
              </div>
            </div>
          </div>
          <div class="col-lg-4 col-md-6 col-sm-9">
            <div class="news-item mt-30">
              <div class="news-thumb">
                <img src="/assets/images/project-9.png" alt="news" />
              </div>
              <div class="news-content text-center">
                <nuxt-link to="/single-author">枚乘</nuxt-link>
                <div class="date">
                  <span
                    ><span>约前210年</span
                    ><span class="pl-10 pr-10"> -</span> 前138年</span
                  >
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </section>
</template>

<script>
export default {
  mounted() {
    /*for (let i = 0; i < this.originTextList.length; i++) {
      this.search_text(this.originTextList[i]);
    }*/
    let userName = JSON.parse(localStorage.getItem("user"));
    if (userName) {
      //userName.username==user.username  对应登录界面设置的key里面的value对应的数组值
      this.username = userName.username;
      this.password = userName.password;
      console.log("this.username:" + this.username);
      // console.log("this.password:" + this.password)
    }
  },
  methods: {
    Esc() {
      this.username = "";
      console.log("登出");
      localStorage.clear();

      this.$router.push("/");
    }
  },
  data() {
    return {
      username: "",
      password: "",
      title: "NLP |作者推荐"
    };
  }
};
</script>
